﻿using Management.Systeam.Domaina;
using Management.Systeam.ErrorCode;
using Management.Systeam.Read.Apis.Application.Command.LedgerManagements;
using Management.Systeam.Read.Apis.Auto.UserDto;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SCM.Domain;

namespace Management.Systeam.Read.Apis.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LedgerManagementAllController : ControllerBase
    {
        IMediator mediator;
        //数据测试
        public LedgerManagementAllController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpGet]
        public async Task<ApiPeaging<ApiResult<List<LedgerManagement>>>> ShowLedgerManagement([FromQuery] ShowLedgerManagementCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public async Task<ApiResult<int>> DelAllLedgerManagement(DelAllLedgerManagementCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
   
        [HttpGet]
        public async Task<ApiResult<LedgerManagement>> FirstLedgerManagement([FromQuery] FirstLedgerManagementsCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public async Task<ApiPeaging<ApiResult<List<LedStoDto>>>> ShowLedStoDto([FromQuery]ShowLedStockingCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public async Task<ApiPeaging<ApiResult<List<LedAccout>>>> ShowLedAccout( [FromQuery] ShowAccountLedCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
